<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简易搜索示例</title>
    <style>
        /* 新增导航栏样式 */
        .nav-bar {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            background: #fff;
            padding: 15px 30px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
            z-index: 1000;
        } 
 
        .nav-links {
            display: flex;
            gap: 25px;
        }

        .nav-links a {
            color: #333;
            text-decoration: none;
            font-size: 14px;
        }

        .nav-links a:hover {
            color: #3385ff;
        }

        /* 调整原有body样式 */
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            padding-top: 70px; /* 为导航栏留出空间 */
            background: #fff;
            margin: 0;
        }

        /* 其他原有样式保持不变... */
    </style>
    <script type="text/javascript" src="./js/ajax.js"></script>
	<script type="text/javascript" src="./js/uri.js"></script> 
	<script type="text/javascript" src="./js/value.js"></script> 
</head>
<body>
    <!-- 新增导航栏 -->
    <nav class="nav-bar">
        <div class="nav-links">
            <a href="#">见闻</a>
            <a href="#">寻才</a>
         <!--  <a href="#">百业</a>    -->  
            <a href="#">百家</a>
        </div> 
        <div class="nav-links">
            <a href="#">语言</a>
            <a href="login.html">登录</a>
            <a href="register.html">注册</a>
        </div>
    </nav> 
  
    <h1>激活账户</h1>
    <div class="search-box">
        <div>
	        <label>注&nbsp;册&nbsp;的&nbsp;邮&nbsp;件:</label>
	        <input type="text" name="email" placeholder="请输入邮箱地址" value="">
	    </div>
        <div>
	      <label>收到的激活码:</label>
	      <input type="text" name="acode" placeholder="输入邮件内的激活码" value="">
	    </div>
	    <div>
	      <label>设置账户密码:</label>
	      <input type="password" name="pwd1" placeholder="登录密码" value="">
	    </div>
	    <div>
	      <label>二次确认密码:</label>
	      <input type="password" name="pwd2" placeholder="登录密码" value="">
	    </div>
        <button id="reg" onClick="active()">激活账户</button>
    </div>
    <div id="results"></div>
 
</body>

<script> 
	
   var email = getValueFromUri("email");
   setInputValue("email",email);
   
   function active(){
	   debugger;
	   var email = getInputValue("email");
	   var lang="cn";
	   var pwd1 = getInputValue("pwd1");
	   var pwd2 = getInputValue("pwd2");
	   if(pwd1 != pwd2 || pwd1=="" || pwd2==""){
		   alert("请输入密码\r\n确认密码和密码必须相同");
		   return;
	   }
	   var code = getInputValue("acode");
	   if(code=="" || code.length !=6 || isDigital(code) == false){
		   alert("激活码为6个数字");
		   return;
	   }
	   var json={"code":code,"email":email,"passwd":pwd1}; //如提供了密码，则修改密码
	   
	   ajaxPostJson(active_uri,null,json,function(status,ret){
			  console.log("Status="+status);
			  console.log("Data="+JSON.stringify(ret,null,2)); 
			  if(ret.status==1){
				  showPage("login.html?email="+email);
			  }else{
				  alert("返回错误代码:"+ret.errCode+"\内容:"+ret.desc);
			  }
		  });
	   
	   
   }
   
</script>
</html>
